package com.af.red;

import java.sql.SQLException;

import org.apache.log4j.Logger;
import org.apache.struts.Globals;

import net.sf.json.JSONObject;

import com.af.common.DBHelper;
import com.af.common.Log4jXmlConfig;

public class AddUserGolds {
	Logger LOG = Log4jXmlConfig.getInstance().returnLogger(AddUserGolds.class);
	/**
	 * 增加积分记录
	 * @param ri
	 * @param creatDate
	 * @return
	 */
	
	public void addGoldsToMember(GoldItem gi){
		DBHelper dh = DBHelper.getInstance();
		String sql = "{call addUserGolds(?,?,?,?,?,?)}";
		Object args[] = new Object[6];
		args[0]=gi.getUserName();
		args[1]=gi.getGold();
		args[2]=gi.getOid();
		args[3]=gi.getFromSys();
		args[4]=gi.getFromType();
		args[5]=gi.getRemarks();
		int count=0;
		try {
			count = dh.update(sql, args);
			LOG.warn("派送积分状态["+count+"]"+JSONObject.fromObject(gi));
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			LOG.error("派送积分失败"+JSONObject.fromObject(gi),e);
		}finally{
		dh.close();
		}
	}
	
}
